package com.qfedu.meidijiaju.service.impl;

import com.qfedu.meidijiaju.common.ResponseData;
import com.qfedu.meidijiaju.entity.FaxiantieziYxy;
import com.qfedu.meidijiaju.entity.QuanzitypeYxy;
import com.qfedu.meidijiaju.mapper.QuanzitypeYxyMapper;
import com.qfedu.meidijiaju.service.QuanzitypeYxyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 圈子类型 服务实现类
 * </p>
 *
 * @author meidimeiju
 * @since 2022-10-03
 */
@Service
public class QuanzitypeYxyServiceImpl extends ServiceImpl<QuanzitypeYxyMapper, QuanzitypeYxy> implements QuanzitypeYxyService {

    @Autowired
    private QuanzitypeYxyMapper quanzitypeYxyMapper;

    @Override
    public ResponseData<List<QuanzitypeYxy>> allQuanzitype() {

        ResponseData<List<QuanzitypeYxy>> responseData = new ResponseData<>();


        List<QuanzitypeYxy> quanzitypeYxyList = quanzitypeYxyMapper.allQuanzitype();

        if (quanzitypeYxyList != null && quanzitypeYxyList.size() > 0){

            responseData.setCode(200);

            responseData.setData(quanzitypeYxyList);

        } else {

            responseData.setCode(400);

            responseData.setMsg("无数据！");
        }
        return responseData;
    }

    @Override
    public ResponseData<List<FaxiantieziYxy>> findTieZiByQuanZiId(int quanziId) {

        ResponseData<List<FaxiantieziYxy>> responseData = new ResponseData<>();

        List<FaxiantieziYxy> faxiantieziYxyList = quanzitypeYxyMapper.findTieZiByQuanZiId(quanziId);

        if (faxiantieziYxyList != null && faxiantieziYxyList.size() > 0){

            responseData.setCode(200);

            responseData.setData(faxiantieziYxyList);
        } else {

            responseData.setCode(400);

            responseData.setMsg("无数据！");
        }

        return responseData;
    }
}
